package com.azdebugit.java8.stream.listtest;

import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

public class Test {
    public static void main(String[] args) {
        List<Tem> list = new ArrayList<>();
        list.add(new Tem(1,"111",true,new Date()));
        list.add(new Tem(2,"131",false,new Date()));
        System.err.println("对象List = " + JSONObject.toJSONString(list));
        List<Dreamer> newList = list.stream().map(e -> {
            Dreamer t = new Dreamer();
            BeanUtils.copyProperties(e, t);
            return t;
        }).collect(Collectors.toList());
        System.err.println("拷贝出来的List = " + JSONObject.toJSONString(newList));
        list.get(0).setId(44);
        String aa ="q001";
        System.out.println(aa.substring(0,1));
        System.err.println("修改list集合对象信息之后  = " + JSONObject.toJSONString(list));
        System.err.println("拷贝出来的List = " + JSONObject.toJSONString(newList));

    }
}